#!/bin/bash
echo "🔧 修复 cbp2make.cpp 语法错误..."

# 备份文件
cp src/cbp2make.cpp src/cbp2make.cpp.backup

# 查找 main 函数并正确插入AI代码
sed -i '/int main(int argc, char\* argv\[\])/,/{$/{
    /{$/a\
    // AICoder 增强模式\
    if (argc > 1 && std::string(argv[1]) == "--ai-mode") {\
        AICoder_AnalyzeProject(argv[2]);\
        return 0;\
    }
}' src/cbp2make.cpp

echo "✅ 语法修复完成"
